package com.jk.bgmainprovider.service;

import com.jk.bgmainprovider.dao.TreeDao;
import com.jk.bgmainprovider.entity.TreeEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 文件名称:TreeService
 *
 * @Description //TODO
 * @Date 2021/8/31 20:50
 * 作者 王乐
 * Copyright (c) 2021,  All Rights Reserved.</pre>
 */
@Component
public class TreeService {

    @Autowired
    private TreeDao treeDao;

    public List<TreeEntity> getTree(Integer pid) {
        List<TreeEntity> list = treeDao.getTree(pid);
        for (TreeEntity treeEntity:list) {
            treeEntity.setNodes(getTree(treeEntity.getId()));
        }
        return list;
    }
}
